#include "const.h"

//
//	NOTE: This is a fairly crude method
//	It is shown to work here: http://codepad.org/sXFxJri1
//

void i_inplacestrip(char *buf) {
	size_t i, n;
	char *base, *p;

	base = buf;
	while(*buf==' ')
		buf++;

	p = strrchr(buf, 0);
	do {
		p--;
	} while(*p==' ');
	p++;

	n = (size_t)(p-buf);

	for(i=0; i<n; i++)
		base[i] = buf[i];
	base[n] = 0;
}
